layui.use([ 'laydate' ], function() {
    var laydate = layui.laydate;
    var $ = layui.jquery;
        $.ajax({
            url: '/SyOperationController/selCurriculumCount',
            type: "post",
            dataType: "json",
            data: {"name": "FeedbackStatistics"},
            success: function (data) {
                d = data.data;
                console.log(d.week);
                console.log(d.month);
                ch(d.day, d.dayData);
            }
        })
        //本月
        $(".active3").on('click', function () {
            $("#tip2").removeAttr("class", "xiaxian ");
            $("#tip1").removeAttr("class", "xiaxian");
            $("#tip3").attr("class", "tip3 xiaxian");
            ch(d.month, d.monthData)
        })
        //本天
        $(".active1").on('click', function () {
            $("#tip2").removeAttr("class", "xiaxian ");
            $("#tip3").removeAttr("class", "xiaxian");
            $("#tip1").attr("class", "tip1 xiaxian");
            ch(d.day, d.dayData)
        })
        //本周
        $(".active2").on('click', function () {
            $("#tip1").removeAttr("class", "xiaxian ");
            $("#tip3").removeAttr("class", "xiaxian");
            $("#tip2").attr("class", "tip2 xiaxian");
            ch(d.week, d.weekData)
        })
        var chart = echarts.init($('#querycnt').get(0));
        var chartOption = {
            legend: {
                data: ["课程量"],
                bottom: 20,
                left: 1500
            },
            grid: {
                top: 10,
                height: 170
            },
            xAxis: {
                data: [],
                axisLabel: {rotate: 0, interval: 0},
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                }
            },
            yAxis: [{
                scale: true,
                name: "",
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                }
            }],
            tooltip: {},
            series: [{
                name: '课程量',
                type: 'line',
                smooth: true,
                data: [],
                itemStyle: {
                    normal: {
                        color: '#5aa7fe'
                    }
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0, color: '#5aa7fe' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#bcdbff' // 100% 处的颜色
                        }], false)
                    }
                }
            }
            ]//series
        };//option
        chart.setOption(chartOption);
        chart.showLoading();
        chart.showLoading();
        chart.hideLoading();
    function ch(data, date) {
        chart.setOption({
            xAxis: {
                data: date
            },
            series: [{
                name: '课程量',
                data: data
            }]
        });
    }

})

